<div id="element-box">	
	<div class="m">
		<div class="subNav">
			<ul>
				<li class="active">
					<div>
						<a title="" href="/admin/user/index"><?php echo $this->translate('admin_user_index_tab')?></a>
					</div>
				</li>
				<li >
					<div>
						<a title="" href="/admin/user/add"><?php echo $this->translate('admin_user_add_tab')?></a>						
					</div>
				</li>				
			</ul>
		</div>

		<div class="head-title">
			<h3>
				<span>Quản lý thành viên / Danh sách</span>
			</h3>
			<div class="wrapBtn">
				<a class="btnUpdate " title="<?php echo $this->translate('admin_table_active_all')?>" href="#">
					<?php echo $this->translate('admin_table_active_all')?></a> 
				<a class="btnUpdate " title="<?php echo $this->translate('admin_table_delete_all')?>" href="#">
					<?php echo $this->translate('admin_table_delete_all')?></a>
			</div>
		</div>
		<form method="post" action="" name="adminForm" id="adminForm">
			<fieldset id="filter-bar">
				<div class="filter-search fltlft">
					<label for="filter_search" class="filter-search-lbl"><?php echo $this->translate('admin_form_filter_keyword')?> : </label>
					<input type="text" title="Search" style="width: 200px" value="<?php echo (isset($this->filterKeyword) && $this->filterKeyword != '') ? $this->filterKeyword : ''?>" 
						id="filter_search" name="filter_keyword">
					<select class="inputbox" name="filter_role">
						<option value="*"><?php echo $this->translate('admin_form_filter_role')?></option>
						<?php 
						foreach ($this->arrRole as $item) {
							$select = '';
							if (isset($this->filterRole) && $item['role_id'] == $this->filterRole) $select = 'selected="selected"';
							echo '<option '.$select.' value="'.$item['role_id'].'">'.$item['role_name'].'</option>';							
						}
						?>							
					</select> 			
					
					<button type="submit">Search</button>
					<button	onclick="document.id('filter_search').value='';this.form.submit();"
						type="button">Clear</button>
				</div>

				<div class="filter-select fltrt">	
					<select  onchange="this.form.submit()" class="inputbox" name="filter_active">
						<option value="*"><?php echo $this->translate('admin_form_filter_published')?></option>
						<option <?php echo (isset($this->filterActive) && $this->filterActive === '1') ? 'selected="selected"' : ''?> value="1">
							<?php echo $this->translate('admin_form_filter_actived')?></option>
						<option <?php echo (isset($this->filterActive) && $this->filterActive === '0') ? 'selected="selected"' : ''?> value="0">
							<?php echo $this->translate('admin_form_filter_deactived')?></option>	
					</select> 				
				</div>
			</fieldset>
			<table class="adminlist">
				<thead>
					<tr>
						<th width="1%"><input type="checkbox"
							onclick="jForm.checkAll(this)" title="Check All" value=""
							name="checkall-toggle">
						</th>
						<th><?php echo $this->translate('admin_table_fullname')?></th>
						<th width="15%"><?php echo $this->translate('admin_table_username')?></th>
						<th width="15%"><?php echo $this->translate('admin_table_email')?></th>
						<th width="10%"><?php echo $this->translate('admin_table_role')?></th>
						<th width="7%"><?php echo $this->translate('admin_table_status')?></th>					
						<th width="12%"><?php echo $this->translate('admin_table_created_date')?></th>								
						<th width="120" class="nowrap"><?php echo $this->translate('admin_table_action')?></th>
					</tr>
				</thead>
	
				<tbody>
					<?php
					$row = true; 
					foreach ($this->arrUser as $item) {
					?>
						<tr class="row<?php echo ($row) ? 0 : 1?>">
							<td class="center"><input type="checkbox" value="<?php echo $item['id']?>" name="cid[]" id="cb0"></td>							
							<td><a href="#"><b><?php echo $item['fullname']?></b></a></td>
							<td><b><?php echo $item['username']?></b></td>
							<td><?php echo $item['email']?></td>
							<td><?php echo isset($this->arrRole[$item['role_id']]) ? $this->arrRole[$item['role_id']]['role_name'] : 'Guest'?></td>
							<td class="center">
								<?php 
								$class = 'unpublish';
								$activeLink = "/admin/user/active/uid/" . $item['id'];
								if (isset($item['active']) && $item['active'] == 1) {
									$class = 'publish';
									$activeLink = "/admin/user/deactive/uid/" . $item['id'];
								}?>
								<a class="jgrid" href="<?php echo $activeLink;?>"><span class="state <?php echo $class?>"><span class="text"></span></span></a>
							</td>							
							<td class="center"><?php echo date('d/m/Y H:i:s', strtotime($item['created_time']))?></td>														
							<td class="center">
								<a class="btnUpdate" href="/admin/user/edit/id/<?php echo $item['id']?>" title="<?php echo $this->translate('admin_table_action_edit')?>">
									<?php echo $this->translate('admin_table_action_edit')?>
								</a>
								<a class="btnUpdate" href="/admin/user/delete/id/<?php echo $item['id']?>" title="<?php echo $this->translate('admin_table_action_delete')?>">
									<?php echo $this->translate('admin_table_action_delete')?>
								</a>
							</td>
						</tr>
					<?php 
						$row = !$row;
					} 
					?>	
				</tbody>
			</table>
		</form>
	</div>
</div>